package com.fqgj.sentry.policy.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.sentry.policy.dao.PcEventDao;
import com.fqgj.sentry.policy.entity.PcEventEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: yujianfu
 * Date: 2017-07-12
 * Time: 09:30:55.300
 */

@Repository
public class PcEventDaoImpl extends AbstractBaseMapper<PcEventEntity> implements PcEventDao {

    @Override
    public List<PcEventEntity> selectEventList(Long merchantId, String code, String name) {
        Map<String, Object> map = new HashMap<>();
        map.put("merchantId", merchantId);
        map.put("code", code);
        map.put("name", name);
        return getSqlSession().selectList(getStatement(".selectEventList"), map);
    }

    @Override
    public List<PcEventEntity> selectByMerchantId(Long merchantId) {
        return getSqlSession().selectList(getStatement(".selectByMerchantId"), merchantId);
    }

    @Override
    public PcEventEntity selectByMerchantIdAndCode(Long merchantId, String code) {
        Map<String, Object> map = new HashMap<>();
        map.put("merchantId", merchantId);
        map.put("code", code);
        return this.getSqlSession().selectOne(this.getStatement(".selectByMerchantIdAndCode"), map);
    }

    @Override
    public List<PcEventEntity> selectListByEventIds(List<Long> eventIds) {

        Map<String, Object> map = new HashMap<>();
        map.put("eventIds", eventIds);
        return getSqlSession().selectList(getStatement(".selectListByEventIds"), map);
    }
}